﻿using MRGSP.SurveyMaster.Core.Model;
using MRGSP.SurveyMaster.Core.Service;
using MRGSP.SurveyMaster.Core.Service.Utils;

namespace MRGSP.SurveyMaster.Service.Utils
{
    public class CheckBoxGenerator : IHtmlGenerator
    {
        public string Generate(Question question)
        {
            return string.Format(@"<input type='checkbox' id='q{0}' name='q{0}' value='true' {1}/>
                                   <input type='hidden' name='q{0}' value='false'/> {2}",
                                 question.Id,
                                 question.Value != null ? "checked" : string.Empty,
                                 question.BuildLabel())
                .Colorize(question);
        }
    }
}